The process of rendering two-dimensional images from three-dimensional scenes is commonly referred to as image processing. As the modern computer industry evolves image processing evolves as well. One particular goal in the evolution of image processing is to make two-dimensional simulations or renditions of three-dimensional scenes as realistic as possible. One limitation of rendering realistic images is that modern monitors display images through the use of pixels.
A pixel is the smallest area of space which can be illuminated on a monitor. Most modern computer monitors will use a combination of hundreds of thousands or millions of pixels to compose the entire display or rendered scene. The individual pixels are arranged in a grid pattern and collectively cover the entire viewing area of the monitor. Each individual pixel may be illuminated to render a final picture for viewing.
One technique for rendering a real world three-dimensional scene onto a two-dimensional monitor using pixels is called rasterization. Rasterization is the process of taking a two-dimensional image represented in vector format (mathematical representations of geometric objects within a scene) and converting the image into individual pixels for display on the monitor. Rasterization is effective at rendering graphics quickly and using relatively low amounts of computational power; however, rasterization suffers from several drawbacks. For example, rasterization often suffers from a lack of realism because it is not based on the physical properties of light, rather rasterization is based on the shape of three-dimensional geometric objects in a scene projected onto a two dimensional plane. Furthermore, the computational power required to render a scene with rasterization scales directly with an increase in the complexity of the scene to be rendered. As image processing becomes more realistic, rendered scenes also become more complex. Therefore, rasterization suffers as image processing evolves, because rasterization scales directly with complexity.
Several alternative techniques rendering a real world three-dimensional scene onto a two-dimensional monitor using pixels have been developed based upon more realistic physical modeling. One such physical rendering technique is called ray tracing. The ray tracing technique traces the propagation of imaginary rays, rays which behave similar to rays of light, into a three-dimensional scene which is to be rendered onto a computer screen. The rays originate from the eye(s) of a viewer sitting behind the computer screen and traverse through pixels, which make up the computer screen, towards the three-dimensional scene. Each traced ray proceeds into the scene and may intersect with objects within the scene. If a ray intersects an object within the scene, properties of the object and several other contributing factors are used to calculate the amount of color and light, or lack thereof, the ray is exposed to. These calculations are then used to determine the final color of the pixel through which the traced ray passed.
The process of tracing rays is carried out many times for a single scene. For example, a single ray may be traced for each pixel in the display. Once a sufficient number of rays have been traced to determine the color of all of the pixels which make up the two-dimensional display of the computer screen, the two dimensional synthesis of the three-dimensional scene can be displayed on the computer screen to the viewer.
Ray tracing typically renders real world three-dimensional scenes with more realism than rasterization. This is partially due to the fact that ray tracing simulates how light travels and behaves in a real world environment, rather than simply projecting a three-dimensional shape onto a two dimensional plane as is done with rasterization. Therefore, graphics rendered using ray tracing more accurately depict on a monitor what our eyes are accustomed to seeing in the real world.
Furthermore, ray tracing also handles increases in scene complexity better than rasterization as scenes become more complex. Ray tracing scales logarithmically with scene complexity. This is due to the fact that the same number of rays may be cast into a scene, even if the scene becomes more complex. Therefore, ray tracing does not suffer in terms of computational power requirements as scenes become more complex as rasterization does.
One major drawback of ray tracing, however, is the large number of calculations, and thus processing power, required to render scenes. This leads to problems when fast rendering is needed. For example, when an image processing system is to render graphics for animation purposes such as in a game console. Due to the increased computational requirements for ray tracing it is difficult to render animation quickly enough to seem realistic (realistic animation is approximately twenty to twenty-four frames per second).
With continued improvements in semiconductor technology in terms of clock speed and increased use of parallelism; however, rasterization becomes viable for more complex images, and real time rendering of scenes using physical rendering techniques such as ray tracing becomes a more practical alternative to rasterization. At the chip level, multiple processor cores are often disposed on the same chip, functioning in much the same manner as separate processor chips, or to some extent, as completely separate computers. In addition, even within cores, parallelism is employed through the use of multiple execution units that are specialized to handle certain types of operations. Hardware-based pipelining is also employed in many instances so that certain operations that may take multiple clock cycles to perform are broken up into stages, enabling other operations to be started prior to completion of earlier operations. Multithreading is also employed to enable multiple instruction streams to be processed in parallel, enabling more overall work to performed in any given clock cycle.
Irrespective of whether raster-based or physical rendering is performed to render image data for a scene, most rendering architectures incorporate some form of pixel fragment generator that feeds one or more pixel shaders to perform pixel shading on individual pixels in a rendered image. Pixel fragment generation refers to the partitioning of geometric primitives placed in a scene into “pixel fragments,” which can represent a single pixel, a group of pixels, or even a fragment of a single pixel from primitive (e.g., where information from multiple fragments are used to generate a color for a single pixel). Pixel fragments are typically generated in a raster-based rendering pipeline using a rasterizer that rasterizes each primitive into its component fragments and outputs all of the fragments for a given primitive to one or more pixel shaders. For physical rendering techniques such as ray tracing, pixel fragment generation may be based upon collisions detected between rays and primitives placed in a scene, resulting in the output of pixel fragments to one or more pixel shaders anytime a traced ray intersects a primitive.
Pixel shading is used to apply a color to each pixel in a rendered image. Pixel shading also often incorporates texture processing, e.g., texture filtering, whereby the color applied to each pixel is based upon textures that have been mapped to one or more primitives that are displayed at a particular pixel location. Due to filtering and other operations that may be performed to paint each pixel with an accurate color, pixel shading can be a highly processor intensive operation.
Conventional rendering architectures typically rely on fixed (and fixed function) hardware-based pipelines to handle the various steps in the rendering process, and often incorporate dedicated and specialized hardware logic in various stages of the pipeline to optimize the performance of different operations required in the rendering process. In a raster-based rendering architecture, for example, a rasterizer stage of a pipeline sorts pixel fragments generated during rasterization based on screen coordinates to pixel shader pipeline elements that perform pixel operations in those screen pixel ranges. Thus, for example, four pixel shader pipeline elements might be architected into a pipeline to respectively handle the four quadrants of a rendered image.
It has been found, however, that a fixed sort of this nature based on screen coordinates, as well as the fixed number of rasterizers that may be architected into a pipeline, can become a “pinch point”, or higher level pipeline bottleneck, if the amount of processing resources architected into the pipeline to handle the rasterization and pixel shading operations are insufficient to handle the desired workload. The decision of the number of rasterizers and pixel shaders, and the type of sort used to route pixel fragments to the pixel shaders, is determined at the front of the design cycle for a particular pipeline in order to target a particular performance target (usually measured in some number of triangles per second with certain visual features enabled—i.e. lit, shader, and multitextured triangles per second). As designed for a particular performance target, therefore, a conventional fixed pipeline may not operate efficiently when utilized to handle workloads that do not match the desired performance target.
Pixel shaders in conventional rendering pipelines may also rely on separate, dedicated texture units to perform texture processing. These texture units can have a relatively high latency and can stall their respective pixel shaders waiting for the texture units to complete. As a result, a pixel shader can be underutilized in some situations, and sit idle waiting on texture processing.
Conventional rendering pipelines are therefore characterized by architectures that are fixed at design time and immutable thereafter. Whether or not a particular architecture operates efficiently for a given workload can therefore vary greatly on the particular characteristics of the workload, thus limiting the flexibility and applicability of many conventional architectures for different image processing applications. A need therefore exists in the art for a more flexible image processing architecture suitable for handling a wider variety of workloads during runtime, particularly with respect to performing pixel shading operations in a rendering pipeline.